
layui.use(['form', 'xmSelect', 'upload', 'laydate'], function () {
	var form = layui.form;
	laydate = layui.laydate;
	form.on('radio(demo-radio-filter)', function(data){

		if(data?.elem?.value=='1'){
			$('#refuseReason').show()
		}else {
			$('#refuseReason').hide()
			$("textarea[name='refuseReason']").val('');
		}

	});

	//提交事件
	form.on('submit(submit)', function (data) {
		let mn=$('#isSubmit').val()
		if(mn=='false') {
			let params=data.field
			params.id = $('#userId').val()
			AjaxPost('/userDemand/examineDeman', params).then(function (response) {
				parent.layer.msg("操作成功");
				var index = parent.layer.getFrameIndex(window.name); // 获取窗口索引
				parent.layer.close(index);
				parent.load();
			}).catch(error => {
				layer.msg(error.msg)
			})
		}else{
			var index = parent.layer.getFrameIndex(window.name); // 获取窗口索引
			parent.layer.close(index);
			parent.load();
		}

	});

});

